package com.arcaneshift.security.exceptions;

import com.common.security.abstracts.AbstractRuntimeException;

/**
 * Error code range: 1181 - 1200
 * 
 * @author Ady
 *
 */
public class CardException extends AbstractRuntimeException {
	private static final long serialVersionUID = 1L;
	
	public static final int ELEMENT_TYPE_NOT_AVAILABLE = 1181;
	private static final String MESSAGE_ELEMENT_TYPE_NOT_AVAILABLE = "The provided element type is unavailable";
	
	public static final int CARD_TYPE_NOT_SUPPORTED = 1182;
	private static final String MESSAGE_CARD_TYPE_NOT_SUPPORTED = "The provided card type is not supported by the system";
	
	public static final int CARD_NOT_FOUND = 1183;
	private static final String MESSAGE_CARD_NOT_FOUND = "The card with the provided data was not found";
	
	public static final int MULTIPLE_CARDS_FOUND = 1184;
	private static final String MESSAGE_MULTIPLE_CARDS_FOUND = "Multiple cards with the provided data were found";
	
	public CardException(int code) {
		super(code, getMessage(code));
	}
	
	private static String getMessage(int code) {
		switch (code) {
			case ELEMENT_TYPE_NOT_AVAILABLE: {
				return MESSAGE_ELEMENT_TYPE_NOT_AVAILABLE;
			}
			case CARD_TYPE_NOT_SUPPORTED: {
				return MESSAGE_CARD_TYPE_NOT_SUPPORTED;
			}
			case CARD_NOT_FOUND: {
				return MESSAGE_CARD_NOT_FOUND;
			}
			case MULTIPLE_CARDS_FOUND: {
				return MESSAGE_MULTIPLE_CARDS_FOUND;
			}
			default: {
				return MESSAGE_ERROR_NOT_FOUND;
			}
		}
	}
}
